import React from 'react';
import { connect } from 'dva';
import { Card } from 'antd';
import _ from 'lodash';

const styles = require('../app.less');

const title = (id, text) => {
  return (
    <div>
      id: {id} | 文本: {text}
    </div>
  );
};

class ExamineRecord extends React.Component {

  componentDidMount() {
    const { dispatch, location } = this.props;
    const packId = _.get(location, 'query.packId');
    dispatch({
      type: 'record/queryRecord',
      payload: {
        id: packId,
      },
    });
  }

  render() {
    const { record } = this.props;
    const records = record.records || [];
    return (
      <div className={styles.container}>
        <br />
        {
          records.map((item) => {
            return [(
              <Card title={title(item.id, item.text)}>
                title
              </Card>
            ),
              <br />,
            ];
          })
        }
      </div>
    );
  }
}

export default connect(state => state)(ExamineRecord);
